<template>
  <div class="subject">
    <span>{{ item.random1 }}</span>
    <span>+</span>
    <span>{{ item.random2 }}</span>
    <span>=</span>
    <input v-model.number="txt" type="number" />
    <button @click="submit" :disabled="dis">提交</button>
  </div>
</template>

<script>
export default {
    props: ['item'],
    data() {
        return {
            dis: false,
            txt: ''
        }
    },
    methods: {
        submit() {
            this.dis = true
            this.$emit('sub',this.txt,this.item.id)
        }
    }
};
</script>

<style scoped>
.subject {
  margin: 5px;
  padding: 5px;
  font-size: 20px;
}
.subject span {
  display: inline-block;
  text-align: center;
  width: 20px;
}
.subject input {
  width: 50px;
  height: 20px;
}
</style>